<%@ page import="java.util.*" %>
<%@ page import="util.*" %>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Sistema CDs</title>
    <link rel="stylesheet" href="style.css">
  </head>
  <h1>Sistema CDs</h1>
  <h2>Detalle de Banda</h2>
  <% BandaDTO banda = (BandaDTO)request.getAttribute("banda"); %>
  <% List CDs = (List)request.getAttribute("CDs"); %>
  
  <form name="ActualizarBanda" action="/actualizarBanda" method="get">
    <input type="hidden" name="pk_banda" value="<%= banda.getPk_banda() %>"/>
    <table>
      <thead>
        <tr>
          <th></th><th></th>
        </tr>
      </thead>
      <tbody>
        <tr>          
          <td>Nombre:</td><td><input type="text" name="nombre" value="<%= banda.getNombre() %>"/></td>
        </tr>
        <tr>
          <td>Genero:</td><td><input type="text" name="genero" value="<%= banda.getGenero() %>"/></td>
        </tr>
        <tr>
          <td>Año de formacion</td>
          <td>
            <input type="text" name="anoFormacion" value="<%= banda.getAnoFormacion() %>"/>
          </td>
        </tr>
        <tr>
          <td>Vigente:</td>
          <td>
            <select name="isVigente">
              <option value="1" <% if(banda.getIsVigente()==1){ %> selected <% } %> >Si</option>
              <option value="0" <% if(banda.getIsVigente()==0){ %> selected<% } %> >No</option>  
            </select>
          </td>
        </tr>      
      </tbody>
      <tfoot>
        <tr>
          <td><input type="submit" value="Actualizar" /></td><td></td>
        </tr>
      </tfoot>
    </table>
  </form>

  <table>
    <thead>
      <tr>
        <th>Nombre</th><th>A&ntilde;o publicaci&oacute;n</th><th>Precio</th><th>Banda</th><th>Acciones</th>
      </tr>
    </thead>
    <tbody>
      <% for(int i = 0, n = CDs.size(); i < n; i++) {
        CDDTO CD= (CDDTO) CDs.get(i); %>
        <tr>
          <td><%= CD.getNombre() %></td>
          <td><%= CD.getAnoPublicacion() %></td>
          <td><%= CD.getPrecio() %></td>
          <td> <%= banda.getNombre() %> </td>
          <td>
            <a href='/detalleCD?pk_CD=<%= CD.getPk_CD() %>'>
                <input type="submit" value="Detalle"/>
            </a>
            <a href='/eliminarCD?pk_CD=<%= CD.getPk_CD() %>'>
              <input type="submit" value="Eliminar"/>
            </a>
          </td>
        </tr>
      <% } %>
    </tbody>
    <tfoot>
      <tr>
        <td>
          <a href='/agregarCD.jsp'>
            <input type="submit" name="action" value="Agregar"/>
          </a>
        </td>
        <td></td><td></td><td></td>
      </tr>
    </tfoot>
  </table>
</html>


